﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorkStation.UI.Controls
{
    public class RectangleMotion : MotionShape
    {
        public PointF StartPoint;
        public PointF EndPoint;
        public RectangleMotion()
        {

        }
        public RectangleMotion(string description)
            : base(description)
        {

        }
        public override void Draw(Graphics g)
        {
            //if(RotateAngle != 0)
            //{
            //    Pen p = new Pen(PaintColor, LineWidth);
            //    g.TranslateTransform((StartPoint.X + EndPoint.X) / 2, (StartPoint.Y + EndPoint.Y) / 2);
            //    g.RotateTransform((float)RotateAngle);
            //    g.DrawRectangle(p, -(EndPoint.X - StartPoint.X) / 2, -(EndPoint.Y - StartPoint.Y) / 2, (EndPoint.X - StartPoint.X) / 2, (EndPoint.Y - StartPoint.Y) / 2);
            //    if (IsFill)
            //    {
            //        g.FillRectangle(new SolidBrush(Color.FromArgb(Alpha, FillColor)), StartPoint.X, StartPoint.Y, EndPoint.X - StartPoint.X, EndPoint.Y - StartPoint.Y);
            //    }
            //    g.RotateTransform(-(float)RotateAngle);
            //    g.TranslateTransform(-(StartPoint.X + EndPoint.X) / 2, -(StartPoint.Y + EndPoint.Y) / 2);
            //}
            //else
            {
                Pen p = new Pen(PaintColor, LineWidth);
                g.DrawRectangle(p, StartPoint.X, StartPoint.Y, EndPoint.X - StartPoint.X, EndPoint.Y - StartPoint.Y);
                if (IsFill)
                {
                    g.FillRectangle(new SolidBrush(Color.FromArgb(Alpha, FillColor)), StartPoint.X, StartPoint.Y, EndPoint.X - StartPoint.X, EndPoint.Y - StartPoint.Y);
                }
            }
        }
    }
}
